<template>
  <div class="content_box">
    <div class="search_header">
      <el-input
        v-model="queryList.userName"
        clearable
        size="small"
        placeholder="请输入姓名"
        @keyup.enter.native="getapplyMemberList"
      />
      <el-button type="primary" @click="getapplyMemberList">搜索</el-button>
    </div>
    <el-table
      :data="applyMemberList"
      border
      fit
      style="width: 100%"
      :element-loading-text="g.loadingStr"
      :header-cell-style="{ background: g.mainColor }"
    >
      <el-table-column label="序号" align="center" fixed>
        <template slot-scope="{ $index }">
          <span>{{
            $index + 1 + (queryList.currentPage - 1) * queryList.pageSize
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="姓名" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.userName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="联系方式" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.phone }}</span>
        </template>
      </el-table-column>
      <el-table-column label="摊位名" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column label="经营范围" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.businessScope }}</span>
        </template>
      </el-table-column>
      <el-table-column label="身份证" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.idCard }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报名时间" align="center">
        <template slot-scope="{ row }">
          <span>{{ row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryList.currentPage"
      :limit.sync="queryList.pageSize"
      @pagination="getapplyMemberList"
    />
  </div>
</template>

<script>
import { applyMemberList } from '@/api/doubleEleven'
import Pagination from '@/components/Pagination'
export default {
  name: 'DoubleEleven',
  components: { Pagination },
  data() {
    return {
      queryList: {
        userName: '',
        phone: '',
        name: '',
        businessScope: '',
        idCard: '',
        currentPage: 1,
        pageSize: 10
      },
      total: 1,
      applyMemberList: []
    }
  },
  mounted() {
    this.getapplyMemberList()
  },
  methods: {
    getapplyMemberList() {
      applyMemberList(this.queryList).then(res => {
        const { records, total } = res.data
        this.total = total
        this.applyMemberList = records
      })
    }
  }
}
</script>

<style scoped lang='scss'>
.content_box {
  padding: 10px;
  .search_header{
      margin-bottom: 10px;
      /deep/ .el-input{
          width: 150px;
      }
  }
}
</style>
